/*
 * @description: 
 * @Author: lal
 * @Date: 2021-04-25 15:42:08
 * @LastEditors: lal
 * @LastEditTime: 2021-04-26 19:02:41
 */
/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    let map = new Map();
    for (let i = 0; i < nums.length; i++){
        let complete = target-nums[i];
        if(map.has(complete)){
            return [map.get(complete),i];
        }else{
            map.set(nums[i],i)
        }
    }

};
// @lc code=end

